import request from './request'

// 获取用户列表
export const getUserList = (params) => {
  return request({
    url: '/users/list',
    method: 'get',
    params
  })
}

// 获取单个用户信息
export const getUserInfo = (id) => {
  return request({
    url: `/users/userInfo/${id}`,
    method: 'get'
  })
}

// 创建用户
export const createUser = (data) => {
  return request({
    url: '/users/add',
    method: 'post',
    data
  })
}

// 更新用户信息
export const updateUser = (id, data) => {
  return request({
    url: `/users/update/${id}`,
    method: 'post',
    data
  })
}

// 删除用户
export const deleteUser = (id) => {
  return request({
    url: `/users/delete/${id}`,
    method: 'post'
  })
}

// 批量删除用户
export const batchDeleteUsers = (data) => {
  return request({
    url: '/users/batch',
    method: 'post',
    data
  })
}

// 重置用户密码
export const resetUserPassword = (id, data) => {
  return request({
    url: `/users/resetPassword/${id}`,
    method: 'post',
    data
  })
}

// 更新用户状态
export const updateUserStatus = (id, status) => {
  return request({
    url: `/users/status/${id}`,
    method: 'post',
    data: { status }
  })
}